//
//  LineOneTypeStyle.cpp
//  fingeradvanture
//
//  Created by shuaibincheng on 16/5/18.
//  
//

#include "LineOneTypeStyle.hpp"
#include "Utils.hpp"

MonsterType LineOneTypeStyle::next()
{
    if(this->currentType != MONSTER_UNKNOWN)
        return this->currentType;
    
    auto types = allowedMonsterTypes();
    
    auto index = Utils::random_int(types.size());
    this->currentType = types[index];
    
    return this->currentType;
}

std::vector<MonsterType> LineOneTypeStyle::allowedMonsterTypes()
{
    std::vector<MonsterType> types;
    
    types.push_back(MONSTER_4);
    types.push_back(MONSTER_5);
    
    if(numOfMonsters <= 3)
    {
        types.push_back(MONSTER_2);
        types.push_back(MONSTER_3);
        types.push_back(MONSTER_6);
    }
    
    if(numOfMonsters <= 2)
    {
        types.push_back(MONSTER_1);
        
        types.push_back(SPIKES_3);
        types.push_back(SPIKES_4);
        types.push_back(SPIKES_1);
        types.push_back(SPIKES_2);
        types.push_back(MONSTER_2_1);
        types.push_back(MONSTER_2_2);
        types.push_back(MONSTER_4_1);
        types.push_back(MONSTER_4_2);
        types.push_back(MONSTER_5_1);
        types.push_back(MONSTER_5_2);
    }
    
    return types;
}